﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WS.EKA.Model;
using WS.EKA.ServiceInterface;
using AttributeRouting.Web.Http;
using WS.EKA.Portal.Filters;

namespace WS.EKA.Portal.Controllers
{
    [AuthencationFilter(true)]
    public class PromotionController:ControllerBase
    {
        IPromotion promotionService;
        public PromotionController(IPromotion promotionService)
        {
            this.promotionService = promotionService;
        }

        [GET("api/promotionbyprice/{shopingCartPrice}")]
        public List<SalesPromotion> Get(decimal shopingCartPrice)
        {
            return promotionService.GetAllPromotion(shopingCartPrice);
        }

        [GET("api/FavourTicketVerify/")]
        public bool VerifyFavourTicket(string ticketCode)
        {
            var ticket= promotionService.VerifyFavourTicket(GetCurrentUser(), ticketCode);
            return ticket != null;
            
        }
    }
}